home *** CD-ROM | disk | FTP | other *** search
/ Web Designer 98 (Professional) / WebDesigner 1.0.iso / cgi2 / fly_tar.z / fly_tar / fly / examples / size.pl < prev    next >
Encoding:
Perl Script  |  1997-01-21  |  567 b   |  34 lines

  1. #!/usr/local/bin/perl
  2. #
  3. #  Simple script using fly to find the dimensions of an image.
  4. #
  5. #  Martin Gleeson, January 1996
  6. #
  7.  
  8. if( ! $ARGV[0] )
  9. {
  10.     print STDERR "Usage: size <GIF image>\n";
  11.     exit(0);
  12. }
  13. foreach $arg (@ARGV)
  14. {
  15.     open(FLY,"> /tmp/fly.$$");
  16.     print FLY "existing $arg\n";
  17.     print FLY "sizex\n";
  18.     print FLY "sizey\n";
  19.     close(FLY);
  20.  
  21.     open(OUT, "fly -i /tmp/fly.$$ -o /dev/null |");
  22.  
  23.     while( <OUT> )
  24.     {
  25.         ($x) = /is\ (\d+)$/ if /Size\ -\ X/;
  26.         ($y) = /is\ (\d+)$/ if /Size\ -\ Y/;
  27.     }
  28.  
  29.     close(OUT);
  30.  
  31.     print "Dimensions of $arg: $x by $y\n";
  32.     undef($x);undef($y);
  33. }
  34.